<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../org/angular.min.js"></script>
</head>
<body>
    <div ng-app="vm" ng-controller="ctrl">
         <table>
             <tr>
                 <td>编号</td>
                 <td>姓名</td>
                 <td>手机号</td>
             </tr>
             <tr ng-repeat="(index,value) in data">
                 <td>{{value.id}}</td>
                 <td>{{value.name}}</td>
                 <td>{{value.mobile|truncate:10}}</td>
             </tr>
         </table>
    </div>
    <script>
        var vm = angular.module('vm',[]);
        vm.filter('truncate',function(){
            return function(mobile,length){
                length = length?length:3;
                return mobile.substr(0,11-length)+new String('*').repeat(length)
            }
        })
        vm.controller('ctrl',['$scope','$filter',function($scope,$filter){
            $scope.data = [
                {id: 1,name: "哈哈",mobile: "15556938617"},
                {id: 2,name: "哇哇",mobile: '13711918732'}
            ]
        }])
    </script>
</body>
</html>